package 上课day1;

import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.stream.Collector;

public class aaa {

	public static void main(String[] args) {
//		Collection<Student> collection1 = new ArrayList<>();
//		Student stu1 = new Student(12, "张三");
//		Student stu2 = new Student(13, "李四");
//		Student stu3 = new Student(14, "王五");
//		Student stu4 = new Student(15, "李屋");
//		Student stu5 = new Student(16, "刘柳");
//		
//		collection1.add(stu1);
//		collection1.add(stu2);
//		collection1.add(stu3);
//		collection1.add(stu4);
//		collection1.add(stu5);
//		Student stu6 = new Student(20, "小明");
//		Student stu7 = new Student(21, "大佬");
//		
//		Collection<Student> collection2 = new ArrayList<>();
//		collection2.add(stu1);
//		collection2.add(stu2);
//		collection2.add(stu3);
//		collection2.add(stu6);
//		collection2.add(stu7);
//
//		
//		collection1.removeAll(collection2);
//		
//		collection1.addAll(collection2);
//		
//		System.out.println("----------------------------");
//		Iterator<Student> it = collection1.iterator();
//		while (it.hasNext()) {
//			Student student = it.next();
//			System.out.println("姓名:" + student.getName() + "\t年龄:" + student.getAge() );
//		}
//		System.out.println("------------------------------");
//		
//		
//		LinkedList<Student> linkedList = new LinkedList<>();
//		linkedList.addAll(collection2);
//		linkedList.add(1, new Student(52, "大厦"));
//		linkedList.remove(3);
//		System.out.println("*****************************************\n第一种 ：");
//		for (int i = 0; i < linkedList.size(); i++) {
//			System.out.println("姓名:" + linkedList.get(i).getName() + "\t年龄:" + linkedList.get(i).getAge());
//		}
//		System.out.println("******************************************\n第二种：");
//		Iterator<Student> iterator = linkedList.iterator();
//		while (iterator.hasNext()) {
//			Student student = (Student) iterator.next();
//			System.out.println("姓名：" + student.getName() + "\t年龄: " + student.getAge());
//		}
//		ListIterator<Student> listIterator = linkedList.listIterator();
//		System.out.println("*******************************************\n第三种：");
//		while (listIterator.hasNext()) {
//			Student student = (Student) listIterator.next();
//			System.out.println("姓名：" + student.getName() + "\t年龄: " + student.getAge());
//		}
//		System.out.println("***********************************反序");
//		while (listIterator.hasPrevious()) {
//			Student student = (Student) listIterator.previous();
//			System.out.println("姓名：" + student.getName() + "\t年龄: " + student.getAge());
//		}
//		
		Student stu1 = new Student(14, "的蝴蝶结和");
		Student stu2 = new Student(25, "的蝴8和");
		
		List list = new ArrayList();
		list.add(stu1);
		list.add(stu2);
		
		System.out.println(((Student)(list.get(0))).getName());
		
	}
}
